/*
  Tên:Trần Hoàng Lâm
  MSSV:11379951
  Lớp:DHTH7DLT
  Ngày hoàn thành:28/04/2012
  */
#ifndef FRMPHIEUNHAPSACH_H
#define FRMPHIEUNHAPSACH_H

#include <QDialog>
#include "mysqlconnection.h"
#include <QMessageBox>
#include "dateformatdelegate.h"
#include "QStandardItem"

namespace Ui {
    class frmPhieuNhapSach;
}

class frmPhieuNhapSach : public QDialog
{
    Q_OBJECT

public:
    explicit frmPhieuNhapSach(QWidget *parent = 0);
    ~frmPhieuNhapSach();
    QString m_MaHD;
    int m_rowIndex;
    bool trangThai;


private:
    Ui::frmPhieuNhapSach *ui;
    MySqlConnection *DB;
    void doiButton(bool b);
    void loadHoaDon();
    QSqlQueryModel *model;
    QSqlQueryModel *qModelCTHD;
    QItemSelectionModel *selectionModel;
    QItemSelectionModel *selectionModelCT;
    void resetTableSelectionEvent();
    void loadChiTietHD(QString MaHD);
    void loadChiTietSach(int MaSach);
    bool quiDinh;
    int nhapToiThieu;
    int quydinhnhapton;
    int indexCTHD;
    QStandardItemModel *dataChiTietHD;
    QStringList lstMaSachXoa;
    int kiemTraCTHD(QString maHD,QString maSach,QString soLuong);


private slots:
    void themHD();
    void suaHD();
    void xoaHD();
    void thoat();
    void themChiTiet();
    void xoaChiTiet();
    void suaChiTiet();
    void selectRowHD();
    void selectRowCTHD();
    void kiemTraSLNhap();
    void eventTextChangeMaSach();
    void eventSelectDateChange();
    void TimHoaDon();
    void loadformSach();
};

#endif // FRMPHIEUNHAPSACH_H
